﻿using System;
using System.Collections.Generic;
using CSUtils;
using G02;
using GlobalTripleJump;
using UnityEngine;
namespace TripleJump {
    /// <summary>
    /// 地面拖尾轨迹
    /// </summary>
    public class CTrailingGround {
        public Transform root; 
        TrailRenderer renderer;

        public void Init() {
            var gg = C128_AssetsCore.GetModel(GlobalTripleJumpCfg.artPath_trailingGround,  1);
            this.root = gg.transform;
            renderer = gg.transform.Find("Trailing").GetComponent<TrailRenderer>();
            gg.gameObject.SetActive(false);
        }

        public void IsShow(bool isShow, Vector3 point, Vector3 normal) {
            root.gameObject.SetActive(isShow);
            root.transform.position = point + normal * 0.05f;
            // if (isShow == false) {
            renderer.Clear();
            // }
            //  Debug.LogErrorFormat("拖尾事件____________{0}", isShow);
        }

        public void S_SetShow(Vector3 point, Vector3 normal) {
            //Debug.LogErrorFormat("_C_RolePosiRing______________________{0}____", distance);
            root.transform.position = point + normal * 0.05f;
            //root.transform.rotation = Quaternion.FromToRotation(Vector3.forward, -normal);
            //distanceRing.transform.localScale = Vector3.one * (distance + 1);
        }
    }
}
